package com.chukun.gateway.registry.api;

import com.chukun.gateway.common.definition.ServiceDefinition;
import com.chukun.gateway.common.instance.ServiceInstance;

/**
 * @author chukun
 * @version 1.0.0
 * @description 注册中心抽象接口
 * @createTime 2023/11/26 20:43
 */
public interface RegisterCenter {

    /**
     *   初始化
     * @param registerAddress
     * @param env
     */
    void init(String registerAddress, String env);

    /**
     * 注册·
     * @param serviceDefinition
     * @param serviceInstance
     */
    void register(ServiceDefinition serviceDefinition, ServiceInstance serviceInstance);

    /**
     * 注销
     * @param serviceDefinition
     * @param serviceInstance
     */
    void deregister(ServiceDefinition serviceDefinition, ServiceInstance serviceInstance);

    /**
     * 订阅所有服务变更
     * @param registerCenterListener
     */
    void subscribeAllServices(RegisterCenterListener registerCenterListener);
}
